//
//  ViolationListBottom.swift
//  TrafficViolation
//
//  Created by eaglelive on 2017/5/4.
//  Copyright © 2017年 eaglelive. All rights reserved.
//

import UIKit

//protocol ViolationListBottomViewDelegate : class {
//    func violationListBottomView(violationListView : ViolationListBottom, amount : Int, count : Int)
//}

class ViolationListBottom:UIView{
    
    //weak var delegate : ViolationListBottomViewDelegate?
    var checkedCount = UILabel()
    var amountLabel = UILabel()
    var state:Int = 1//区分是否有数据 0 没有违章数据 1：有违章
    override func layoutSubviews() {
        super.layoutSubviews()
        let submitBtn = UIButton(type: .custom)
        submitBtn.setTitleColor(UIColor.white, for: .normal)
        submitBtn.setTitle("提交订单", for: .normal)
        submitBtn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
        if 0 ==  state{
            submitBtn.backgroundColor = UIColor.lightGray
            submitBtn.isEnabled = false
        }else{
            submitBtn.backgroundColor = appMainColor
        }
        submitBtn.showsTouchWhenHighlighted = true
        submitBtn.layer.cornerRadius = 5
        let vlc = ViolationListController()
        submitBtn.addTarget(vlc, action: #selector(vlc.submitBtnClick(sender:)), for: UIControlEvents.touchUpInside)
        self.addSubview(submitBtn)
        submitBtn.snp.makeConstraints { (make) in
            make.height.equalTo(35)
            make.width.equalTo(70)
            make.right.equalTo(self).offset(-10)
            make.bottom.equalTo(self).offset(-5)
        }
        let label = UILabel()
        label.text = "共计费用"
        label.textColor = UIColor.gray
        label.font = UIFont.systemFont(ofSize: 12)
        self.addSubview(label)
        label.snp.makeConstraints { (make) in
            make.height.equalTo(40)
            make.top.equalTo(self).offset(-5)
            make.left.equalTo(self.snp.left).offset(10)
            make.width.equalTo(55)
        }
        let labelT = UILabel()
        labelT.text = "￥"
        labelT.textColor = UIColor.red
        labelT.font = UIFont.systemFont(ofSize: 12)
        self.addSubview(labelT)
        labelT.snp.makeConstraints { (make) in
            make.height.equalTo(40)
            make.top.equalTo(self).offset(-5)
            make.left.equalTo(self.snp.left).offset(65)
            make.width.equalTo(10)
        }
        
        amountLabel.textColor = UIColor.red
        amountLabel.font = UIFont.systemFont(ofSize: 14)
        self.addSubview(amountLabel)
        amountLabel.snp.makeConstraints { (make) in
            make.height.equalTo(40)
            make.top.equalTo(self).offset(-5)
            make.left.equalTo(self.snp.left).offset(75)
        }
        let image = UIImageView(image: UIImage(named: "wenhao"))
        self.addSubview(image)
        image.snp.makeConstraints { (make) in
            make.width.height.equalTo(15)
            make.bottom.equalTo(self).offset(-5)
            make.left.equalTo(self.snp.left).offset(10)
        }
        let notice = UILabel()
        notice.text = "服务须知  已选"
        notice.font = UIFont.systemFont(ofSize: 12)
        notice.textColor = UIColor.gray
        self.addSubview(notice)
        notice.snp.makeConstraints { (make) in
            make.width.equalTo(85)
            make.bottom.equalTo(self).offset(-5)
            make.left.equalTo(self.snp.left).offset(30)
        }
        checkedCount.font = UIFont.systemFont(ofSize: 12)
        checkedCount.textColor = appMainColor
        self.addSubview(checkedCount)
        checkedCount.snp.makeConstraints { (make) in
            make.width.equalTo(20)
            make.bottom.equalTo(self).offset(-5)
            make.left.equalTo(self.snp.left).offset(115)
        }
        let countLabel = UILabel()
        countLabel.text = "条"
        countLabel.font = UIFont.systemFont(ofSize: 12)
        countLabel.textColor = UIColor.gray
        self.addSubview(countLabel)
        countLabel.snp.makeConstraints { (make) in
            make.width.equalTo(10)
            make.bottom.equalTo(self).offset(-5)
            make.left.equalTo(self.snp.left).offset(135)
        }
    }
}
